home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / Premiere 4.2 SDK r3 Mac / Examples / Projects / Flatten Movie / Flatten Movie.c < prev    next >
Encoding:
Text File  |  1996-01-25  |  3.1 KB  |  85 lines  |  [TEXT/CWIE]

  1. //========================================================================================
  2. //
  3. // Flat Movie.c - An export module to flatten QuickTime movies.
  4. //
  5. // Written by Randy Ubillos and Bryan K. "Beaker" Ressler.
  6. //
  7. // Copyright ⌐ 1993-96, Adobe Systems Incorporated, all rights reserved worldwide.
  8. //
  9. // Version    1.00    10/20/93    Original version
  10. // Version    1.01    9/12/94        Updated for 4.0
  11. // Version  1.02    10/8/95     Updated for 4.2 and CW7.
  12. //
  13. //========================================================================================
  14.  
  15. //========================================================================================
  16. // Includes - use precompiled headers if compiling with CodeWarrior.
  17. //========================================================================================
  18. #ifdef __MWERKS__
  19.     #ifdef powerc
  20.         #include "PremierePPC"
  21.     #else
  22.         #include "Premiere68k"
  23.     #endif
  24. #else
  25.     #include "Premiere.h"
  26. #endif
  27.  
  28. //========================================================================================
  29. // Constants
  30. //========================================================================================
  31. enum {                    // Resource IDs
  32.     frStrings = 600        // STR# - our strings (including errors)
  33. };
  34.  
  35. enum {                    // Strings in our STR#
  36.     fsPrompt = 1,        // Prompt for standard file
  37.     fsSuffix,            // Suffix to append to the end of the filename
  38.     fsErrNotAMovie        // Tried to export a clip that's not a QT movie
  39. };
  40.  
  41. //========================================================================================
  42. // Export module entry point
  43. //========================================================================================
  44. pascal short main (short selector, DataExportHandle theData)
  45. {
  46.     Str63                prompt, suffix, defaultName;
  47.     StandardFileReply    reply;
  48.     FSSpec                theSpec;
  49.     Movie                theMovie;
  50.     short                resID, result = 0;
  51.     
  52.     // Act according to the selector
  53.     switch (selector) {
  54.         case edExecute:
  55.             // This export module only works with movies. GetExportMovie gets the movie
  56.             // handle (if any) and returns it. If it's not a movie, it returns nil.
  57.             theMovie = GetExportMovie(theData);
  58.             if (theMovie != nil) {
  59.                 // Get the standard put file prompt from our string list, then get the
  60.                 // FSSpec for the clip we're flattening so we have a default name. Get the
  61.                 // ".flat" stuffix from the string list, too.
  62.                 GetIndString(prompt, frStrings, fsPrompt);
  63.                 GetExportFSSpec(theData, &theSpec);
  64.                 GetIndString(suffix, frStrings, fsSuffix);
  65.                 
  66.                 // Copy the clip name to the default save name. Append the suffix.
  67.                 BlockMove(theSpec.name, defaultName, theSpec.name[0] + 1);
  68.                 Append(defaultName, suffix);
  69.  
  70.                 // Put up a standard put file dialog to get a new name from the user.
  71.                 StandardPutFile(prompt, defaultName, &reply);
  72.                 if (reply.sfGood) {
  73.                     // Call QuickTime to flatten the movie.
  74.                     resID = 0;
  75.                     theSpec = reply.sfFile;
  76.                     FlattenMovie(theMovie,
  77.                         flattenAddMovieToDataFork + flattenActiveTracksOnly, &theSpec,
  78.                         'PrMr', 0, createMovieFileDeleteCurFile, &resID, nil);
  79.                 }
  80.             } else AlertSystem(0, false, frStrings, fsErrNotAMovie, 0, 0);
  81.             break;
  82.     }
  83.     return(result);
  84. }
  85.